<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/9/14
  Time: 15:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="base" value="${pageContext.request.contextPath}"/>
<html>
<head>
  <script type="text/javascript" src="${base}/asset/js/jquery.min.js"></script>
  <script type="text/javascript" src="${base}/asset/js/jquery.form.js"></script>
    <title></title>


  <script type="text/javascript">
    function save(){
//      $('#customerFrom').ajaxForm(function(data){
//        alert(data);
//      });

      $.ajax( {
        type : "POST",
        url : "customer_save",
        data : $("#customerFrom").serialize(),
        dataType : "json",
        success : function(data) {
          alert(data);
        }
      });
    }

  </script>
</head>
<body>
<form id="customerFrom" action="/customer_save" method="post">
    <table>
      <thead>
      <tr>
        <td>姓名</td>
        <td>邮箱</td>
        <td>备注</td>
      </tr>
      </thead>
      <tr>
        <td>
          <input name="name" value="${customer.name}"/>
        </td>
        <td>
          <input name="email" value="${customer.email}"/>
        </td>
        <td>
          <input name="remark" value="${customer.remark}"/>
        </td>
      </tr>
      <tr>
        <td colspan="3">
          <input name="id" type="hidden" value="${customer.id}"/>
          <button type="button" onclick="save()" value="提交"/>提交
        </td>
      </tr>
    </table>
</form>
</body>
</html>
